/*
 * @Author: liuzhou
 * @Date: 2022-04-22 10:31:06
 * @LastEditTime: 2022-09-01 16:54:49
 * @LastEditors: liuzhou
 * @Description: branchManage model
 * @FilePath: /maycur-koa/model/staticFilesManageModel.js
 */
'use strict';
const moment = require('moment');
const Sequelize = require('sequelize');
const { Model } = Sequelize;

const mysql = require('../common/mysql');
class staticFiles extends Model { }

// 项目表
staticFiles.init({
    id: {
        type: Sequelize.INTEGER,
        primaryKey: true,
        autoIncrementIdentity: true,
    },
    fileLink: {
        type: Sequelize.STRING,
    },
    name: {
        type: Sequelize.STRING,
    },
    directory: {
        type: Sequelize.STRING,
    },
    remarks: {
        type: Sequelize.STRING,
    },
    fileList: {
        type: Sequelize.JSON,
    },
    createdAt: {
        type: Sequelize.DATE,
        get() {
            return moment(this.getDataValue('createdAt')).format('YYYY-MM-DD HH:mm:ss');
        }, 
    },
    updatedAt: {
        type: Sequelize.DATE,
        get() {
            return moment(this.getDataValue('updatedAt')).format('YYYY-MM-DD HH:mm:ss');
        }, 
    },
    invalid: {
        type: Sequelize.STRING,
    },
}, {
    sequelize: mysql,
    modelName: 'staticFiles',
    timestamps: true,
})

module.exports = {
    staticFiles
};